﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing.Imaging;
using System.Data.OleDb;

namespace Auto.BusMan.Report
{
    public partial class CarSpecHundredOilUsingRpt : System.Web.UI.Page
    {
        private void Page_Load(object sender, System.EventArgs e)
        {
            //请先修改Web.Config里面的数据库连接字符串的.mdb文件的路径

            //第一步：设置一个属性（只需要从枚举类型中选取就可以了）
            Chartlet1.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Bar_2D_StarryNight_FlatCrystal_Glow;

            //可选步骤
            //如果你要改变颜色，请取消下面一行的注释，并可以修改参数的值 0 ～ 12 (预置了12种典型颜色)
            //Chartlet1.FillShiftStep = 8;

            string strSql = @"  SELECT bl.BusIdentificationNO
                                              --,b.[CompanyName],bl.BusSpec
                                              ,100*(SUM(b.[OilVolumeByCard])+SUM(b.[OilVolumeByCash]))/MAX(b.[OdometerBus]) AS HundredOilUsing
                                          --INTO A
                                          FROM [Bus_BusOilManage] b
                                          LEFT JOIN Bus_BusList bl ON bl.BusID=b.BusID
                                          LEFT JOIN Bus_Drivers d ON d.DriverID=b.DriverID WHERE 1=1 ";
            //if( 1==2)
            //{
            //   strSql+=" AND b.CompanyID='" + "" + "' "; //
            //}
            //if (1==2)
            //{
            //    strSql += " AND bl.BusSpec='" + "" + "'";
            //}
                                          
           strSql += " GROUP BY bl.BusIdentificationNO,b.CompanyName,bl.BusSpec";

            SqlDataSource1.SelectCommand = strSql;

            //第二步：绑定一个数据源
            Chartlet1.BindChartData(SqlDataSource1);
            

            //好了，运行一下看看，是不是一个很美丽的图表出现了？
            //Chartlet就这么简单
        }
    }

}